#ifndef __DRIVER_CST816_H
#define __DRIVER_CST816_H

/*********************
 *      INCLUDES
 *********************/
#include "driver_gpio.h"
#include "driver_i2c.h"
#include "driver_system.h"

#include "co_printf.h"
#include "co_log.h"

#define CST816D_EN  0

#define CST816T_EN   1

/*********************
 *      DEFINES
 *********************/
#if CST816D_EN
#define CST816_RST_SET			gpio_write_pin(GPIO_A, GPIO_PIN_5, GPIO_PIN_SET)
#define CST816_RST_CLR			gpio_write_pin(GPIO_A, GPIO_PIN_5, GPIO_PIN_CLEAR)

#elif CST816T_EN

 
#define CST816T_EXTI_LINE  		 EXTI_LINE14_PB6
#define CST816T_EXTI_GPIO_NUM  GPIO_PIN_6
#define CST816T_EXTI_PORT  		 GPIO_B

#define CST816T_SDA_GPIO_NUM  	GPIO_PIN_5
#define CST816T_SCL_GPIO_NUM  	GPIO_PIN_4
#define CST816T_IIC_PORT  		  GPIO_A

#define CST816T_RST_GPIO_NUM   GPIO_PIN_7
#define CST816T_RST_PORT  		 GPIO_B

#define CST816_RST_SET			gpio_write_pin(CST816T_RST_PORT, CST816T_RST_GPIO_NUM, GPIO_PIN_SET)
#define CST816_RST_CLR			gpio_write_pin(CST816T_RST_PORT, CST816T_RST_GPIO_NUM, GPIO_PIN_CLEAR)


#endif

/**********************
 *      TYPEDEFS
 **********************/

/**********************
 * GLOBAL PROTOTYPES
 **********************/
void cst816_init(void);
void cst816_exti_isr_handle(void);
bool cst816_read_bytes(uint8_t regaddr,uint8_t* pdata,uint16_t len);
/**********************
 *      MACROS
 **********************/
 





#endif
